<template>
    <el-table :data="list" style="width: 100%">
    
    <el-table-column label="选择" width="55">
      <template #default="scope"><el-checkbox v-model="scope.row.state" size="large"  @change="checkHandle(scope.$index)"
        :disable="show==!scope.row.state"/></template>
    </el-table-column>
    <el-table-column label="编号" width="80">
      <template #default="scope">{{ scope.row.id }}</template>
    </el-table-column>
    <el-table-column label="待办事项" width="200">
      <template #default="scope">{{ scope.row.content }}</template>
    </el-table-column>
    <el-table-column label="开始时间" width="150">
      <template #default="scope">{{ scope.row.startDate }}</template>
    </el-table-column>
    <el-table-column label="结束时间" width="150">
      <template #default="scope">{{ scope.row.finishDate }}</template>
    </el-table-column>
    
   

    <el-table-column align="right">
      <template #default="scope">
        <el-button
          size="small"
          type="primary"
          @click="handleDelete(scope.$index, scope.row)"
        >
         删除
        </el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import {ElMessageBox,} from 'element-plus'

export default {
  data(){
    return{
      show:false,
      list1:this.list,
    }
  },
    props:{list:Array},
    methods:{
      checkHandle(i){
        ElMessageBox.confirm(
          '确定完成吗?',
          '真的吗',
          {
            confirmButtonText: '确认',
            cancelButtonText: '先算了',
            type: 'warning',
          }
      )
        .then(() => {
          this.$emit('finish',i)
        })
        .catch(() => {
          this.$emit('cancer',i)
          // this.list1[i].state=false
        })
      },
      handleDelete(i){
        ElMessageBox.confirm(
              '确定删除吗?',
              '真的吗',
              {
                confirmButtonText: '确认',
                cancelButtonText: '先算了',
                type: 'warning',
              }
      )
        .then(() => {
          this.$emit('del',i)
        })
        .catch(() => {
        
        })
      },
      
}
}
</script>